<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/jsp/manage/common/taglibs.jsp" %>
<div class="bodyUPS" style="position: relative">
    <div style="position: absolute;left: 20px;top:10px ; width: 70px; text-align: center;color: #47a6f5;cursor:pointer;border: 1px solid  #47a6f5;line-height: 28px"
         onclick="manage_sys_opens('中心机房','/manage/demo/powerPage/tosecondaryPages.html')">返回</div>
<div class="container"><div class="EMStop1"></div></div>
<div class="container1">
    <div class="EMSUspContent"> <p class="EMStitle" style="position: absolute;top:40px ;position: relative">UPS实时监控</p>
        <div class="content">
            <div class="left">
                <div class="upsSd" style="background-position:bottom; background-image: url('/manage/assert/image/ups.gif');">
                    <div class="loading" id="box">

                    </div>
                </div>
                <p>连接状态 :<span class="linkSuccess"></span></p>
            </div>
            <div style="overflow: hidden;width:69% ">
            <div class="right" style="height: 380px; width:calc(100% + 19px);overflow: auto;font-size: 18px">
                <table id="upsState_table" border="2">
                    <tr>
                        <th class="blueBg">标题</th>
                        <th class="blueBg">A相</th>
                        <th class="blueBg">B相</th>
                        <th class="blueBg">C相</th>
                    </tr>
                    <tr>
                        <th class="blueBg">1.市电输入电压</th>
                        <td><span name="acInVoltagea"></span></td>
                        <td><span name="acInVoltageb"></span></td>
                        <td><span name="acInVoltagec"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">2.市电输入电流</th>
                        <td><span name="acInCurrenta"></span></td>
                        <td><span name="acInCurrentb"></span></td>
                        <td><span name="acInCurrentc"></span></td>
                    </tr>

                    <tr>
                        <th class="blueBg">3.UPS输出电压</th>
                        <td><span name="acOutVoltagea"></span></td>
                        <td><span name="acOutVoltageb"></span></td>
                        <td><span name="acOutVoltagec"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">4.UPS输出电流</th>
                        <td><span name="acOutCurrenta"></span></td>
                        <td><span name="acOutCurrentb"></span></td>
                        <td><span name="acOutCurrentc"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">5.负载</th>
                        <td><span name="loadPercentagea"></span></td>
                        <td><span name="loadPercentageb"></span></td>
                        <td><span name="loadPercentagec"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">6.输出有功功率</th>
                        <td><span name="outEffectivePowera"></span></td>
                        <td><span name="outEffectivePowerb"></span></td>
                        <td><span name="outEffectivePowerc"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">7.输出无功功率</th>
                        <td><span name="outInvalidPowera"></span></td>
                        <td><span name="outInvalidPowerb"></span></td>
                        <td><span name="outInvalidPowerc"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">8.交流输出频率</th>
                        <td><span name="acOutRatea"></span></td>
                        <td><span name="acOutRateb"></span></td>
                        <td><span name="acOutRatec"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">9.输出视在功率</th>
                        <td><span name="outLookPowera"></span></td>
                        <td><span name="outLookPowerb"></span></td>
                        <td><span name="outLookPowerc"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">10.交流旁路电压</th>
                        <td><span name="acVoltagea"></span></td>
                        <td><span name="acVoltageb"></span></td>
                        <td><span name="acVoltagec"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">11.交流旁路电流</th>
                        <td><span name="acCurrenta"></span></td>
                        <td><span name="acCurrentb"></span></td>
                        <td><span name="acCurrentc"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">12.交流旁路频率</th>
                        <td><span name="acRatea"></span></td>
                        <td><span name="acRateb"></span></td>
                        <td><span name="acRatec"></span></td>
                    </tr>

                    <tr>
                        <th class="blueBg">13.供电方式</th>
                        <td><span name="field81"></span></td>
                        <th class="blueBg">电池状态</th>
                        <td><span  name="field82"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">14.环境温度</th>
                        <td><span name="envTemperature"></span></td>
                        <th class="blueBg">正电池组电压</th>
                        <td><span  name="positiveBatteryVoltage"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">15.负电池组电压</th>
                        <td><span  name="negativeBatteryVoltage"></span></td>
                        <th class="blueBg">电池温度</th>
                        <td><span  name="batteryTemperature"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">16.电池剩余时间</th>
                        <td><span  name="batteryRemainCapacity"></span></td>
                        <th class="blueBg">电池容量</th>
                        <td><span  name="batteryCapacity"></span></td>
                    </tr>

                    <tr>
                        <th class="blueBg">17.电池自检状态</th>
                        <td><span  name="field99"></span></td>
                        <th class="blueBg">电池维护时间</th>
                        <td><span  name="">未维护检测</span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">18.电池连接状态</th>
                        <td><span  name="field83" class="linkSuccess"></span></td>
                        <th class="blueBg">维修旁路空开状态</th>
                        <td><span  name="field84" class="linkSuccess"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">19.旁路相序故障</th>
                        <td><span  name="field89" class="linkSuccess"></span></td>
                        <th class="blueBg">旁路电压故障</th>
                        <td><span  name="field90" class="linkSuccess"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">19.旁路超跟踪</th>
                        <td><span  name="field94" class="linkSuccess"></span></td>
                        <th class="blueBg">切换次数到</th>
                        <td><span  name="field95" class="linkSuccess"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">20.电池接反</th>
                        <td><span  name="field108" class="linkSuccess"></span></td>
                        <th class="blueBg">输入N线断开</th>
                        <td><span  name="field110" class="linkSuccess"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">21.逆变器启动容量不足</th>
                        <td><span  name="field86" class="linkSuccess"></span></td>
                        <th class="blueBg">发电机接入</th>
                        <td><span  name="field87" class="linkSuccess"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">22.旁路故障</th>
                        <td><span  name="field91" class="linkSuccess"></span></td>
                        <th class="blueBg">旁路过载</th>
                        <td><span  name="field92" class="linkSuccess"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">23.输出短路</th>
                        <td><span  name="field96" class="linkSuccess"></span></td>
                        <th class="blueBg">电池EOD</th>
                        <td><span  name="field97" class="linkSuccess"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">24.旁路风扇故障</th>
                        <td><span  name="field111" class="linkSuccess"></span></td>
                        <th class="blueBg">交流输入故障</th>
                        <td><span  name="field88" class="linkSuccess"></span></td>
                    </tr>
                    <tr>
                        <th class="blueBg">25.旁路过载超时</th>
                        <td><span  name="field93" class="linkSuccess"></span></td>
                        <th class="blueBg">电池低压</th>
                        <td><span  name="field107" class="linkSuccess"></span></td>
                    </tr>
                </table>
            </div>
            </div>
        </div>
    </div>
</div>
<script>
    $(function () {
        var count = 0;
        var t = setInterval(function () {
            var $redDiv = $("#box").find(".greenBg");
            if(count === 15){
                count=-1;
                $("#box").find('.greenBg').removeClass('greenBg').addClass('white');
                $redDiv=$("#box").find(".first");
                $("#box").find(".last").removeClass("greenBg").addClass("white");
            }
            $redDiv.next().removeClass("white").addClass("greenBg");
            count++;
        }, 1000);

       // if($.websocket.socketMsgs){
        $.post("/manage/demo/equipment/fetchLastData.html?eids="+ $.websocket.ups,function (entity) {
            //var entity = $.websocket.upsall
            //  var entity=JSON.parse(socketMsg.entity)
            if (entity.equipmentid == $.websocket.ups) {//ups状态
                $("#upsState_table span[name='acInCurrenta']").text(entity.acInCurrenta.toFixed(2));
                $("#upsState_table span[name='acInCurrentb']").text(entity.acInCurrentb.toFixed(2));
                $("#upsState_table span[name='acInCurrentc']").text(entity.acInCurrentc.toFixed(2));

                $("#upsState_table span[name='acRatea']").text(entity.acRatea.toFixed(2));
                $("#upsState_table span[name='acRateb']").text(entity.acRateb.toFixed(2));
                $("#upsState_table span[name='acRatec']").text(entity.acRatec.toFixed(2));

                $("#upsState_table span[name='acInCurrenta']").text(entity.acInCurrenta.toFixed(2));
                $("#upsState_table span[name='acInCurrentb']").text(entity.acInCurrentb.toFixed(2));
                $("#upsState_table span[name='acInCurrentc']").text(entity.acInCurrentc.toFixed(2));

                $("#upsState_table span[name='acInVoltagea']").text(entity.acInVoltagea.toFixed(2));
                $("#upsState_table span[name='acInVoltageb']").text(entity.acInVoltageb.toFixed(2));
                $("#upsState_table span[name='acInVoltagec']").text(entity.acInVoltagec.toFixed(2));
                $("#upsState_table span[name='acInPha']").text(entity.acInPha.toFixed(2));
                $("#upsState_table span[name='acInPhb']").text(entity.acInPhb.toFixed(2));
                $("#upsState_table span[name='acInPhc']").text(entity.acInPhc.toFixed(2));
                $("#upsState_table span[name='acOutVoltagea']").text(entity.acOutVoltagea.toFixed(2));
                $("#upsState_table span[name='acOutVoltageb']").text(entity.acOutVoltageb.toFixed(2));
                $("#upsState_table span[name='acOutVoltagec']").text(entity.acOutVoltagec.toFixed(2));
                $("#upsState_table span[name='acInRatea']").text(entity.acInRatea.toFixed(2));
                $("#upsState_table span[name='acInRateb']").text(entity.acInRateb.toFixed(2));
                $("#upsState_table span[name='acInRatec']").text(entity.acInRatec.toFixed(2));
                $("#upsState_table span[name='acOutCurrenta']").text(entity.acOutCurrenta.toFixed(2));
                $("#upsState_table span[name='acOutCurrentb']").text(entity.acOutCurrentb.toFixed(2));
                $("#upsState_table span[name='acOutCurrentc']").text(entity.acOutCurrentc.toFixed(2));
                $("#upsState_table span[name='loadPercentagea']").text(entity.loadPercentagea.toFixed(2));
                $("#upsState_table span[name='loadPercentageb']").text(entity.loadPercentageb.toFixed(2));
                $("#upsState_table span[name='loadPercentagec']").text(entity.loadPercentagec.toFixed(2));
                $("#upsState_table span[name='outEffectivePowera']").text(entity.outEffectivePowera.toFixed(2));
                $("#upsState_table span[name='outEffectivePowerb']").text(entity.outEffectivePowerb.toFixed(2));
                $("#upsState_table span[name='outEffectivePowerc']").text(entity.outEffectivePowerc.toFixed(2));
                $("#upsState_table span[name='outInvalidPowera']").text(entity.outInvalidPowera.toFixed(2));
                $("#upsState_table span[name='outInvalidPowerb']").text(entity.outInvalidPowerb.toFixed(2));
                $("#upsState_table span[name='outInvalidPowerc']").text(entity.outInvalidPowerc.toFixed(2));
                $("#upsState_table span[name='acOutRatea']").text(entity.acOutRatea.toFixed(2));
                $("#upsState_table span[name='acOutRateb']").text(entity.acOutRateb.toFixed(2));
                $("#upsState_table span[name='acOutRatec']").text(entity.acOutRatec.toFixed(2));
                $("#upsState_table span[name='outLookPowera']").text(entity.outEffectivePowera.toFixed(2));
                $("#upsState_table span[name='outLookPowerb']").text(entity.outEffectivePowerb.toFixed(2));
                $("#upsState_table span[name='outLookPowerc']").text(entity.outEffectivePowerc.toFixed(2));
                $("#upsState_table span[name='acVoltagea']").text(entity.outEffectivePowera.toFixed(2));
                $("#upsState_table span[name='acVoltageb']").text(entity.outEffectivePowerb.toFixed(2));
                $("#upsState_table span[name='acVoltagec']").text(entity.outEffectivePowerc.toFixed(2));
                $("#upsState_table span[name='acCurrenta']").text(entity.acCurrenta.toFixed(2));
                $("#upsState_table span[name='acCurrentb']").text(entity.acCurrentb.toFixed(2));
                $("#upsState_table span[name='acCurrentc']").text(entity.acCurrentc.toFixed(2));
                $("#upsState_table span[name='acOutPha']").text(entity.acOutPha.toFixed(2));
                $("#upsState_table span[name='acOutPhb']").text(entity.acOutPhb.toFixed(2));
                $("#upsState_table span[name='acOutPhc']").text(entity.acOutPhc.toFixed(2));
                $("#upsState_table span[name='envTemperature']").text(entity.envTemperature.toFixed(2));
                $("#upsState_table span[name='positiveBatteryVoltage']").text(entity.positiveBatteryVoltage.toFixed(2));
                $("#upsState_table span[name='negativeBatteryVoltage']").text(entity.negativeBatteryVoltage.toFixed(2));
                $("#upsState_table span[name='batteryTemperature']").text(entity.batteryTemperature);
                $("#upsState_table span[name='batteryRemainCapacity']").text(entity.batteryRemainCapacity);
                $("#upsState_table span[name='batteryCapacity']").text(entity.batteryCapacity);


                if (entity.field81 == 0) {
                    $("#upsState_table span[name='field81']").text("均不供电");
                } else if (entity.field81 == 1) {
                    $("#upsState_table span[name='field81']").text("ups供电");
                } else if (entity.field81 == 2) {
                    $("#upsState_table span[name='field81']").text("旁路供电");
                }
                if (entity.field82 == 0) {
                    $("#upsState_table span[name='field82']").text("电池为工作");
                } else if (entity.field82 == 1) {
                    $("#upsState_table span[name='field82']").text("电池浮充");
                } else if (entity.field82 == 2) {
                    $("#upsState_table span[name='field82']").text("电池均充");
                } else if (entity.field82 == 3) {
                    $("#upsState_table span[name='field82']").text("电池放电");
                }
                if (entity.field99 == 0) {
                    $("#upsState_table span[name='field99']").text("未自检");
                } else {
                    $("#upsState_table span[name='field99']").text("成功");
                }
                if (entity.field83 == 0) {
                    $("#upsState_table span[name='field83']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field83']").css("background-color", "green");
                }
                if (entity.field84 == 1) {
                    $("#upsState_table span[name='field84']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field84']").css("background-color", "green");
                }
                if (entity.field89 == 1) {
                    $("#upsState_table span[name='field89']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field89']").css("background-color", "green");
                }
                if (entity.field90 == 1) {
                    $("#upsState_table span[name='field90']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field90']").css("background-color", "green");
                }
                if (entity.field94 == 1) {
                    $("#upsState_table span[name='field94']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field94']").css("background-color", "green");
                }
                if (entity.field95 == 1) {
                    $("#upsState_table span[name='field95']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field95']").css("background-color", "green");
                }
                if (entity.field108 == 1) {
                    $("#upsState_table span[name='field108']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field108']").css("background-color", "green");
                }
                if (entity.field110 == 1) {
                    $("#upsState_table span[name='field110']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field110']").css("background-color", "green");
                }
                if (entity.field86 == 1) {
                    $("#upsState_table span[name='field86']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field86']").css("background-color", "green");
                }
                if (entity.field87 == 1) {
                    $("#upsState_table span[name='field87']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field87']").css("background-color", "green");
                }
                if (entity.field91 == 1) {
                    $("#upsState_table span[name='field91']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field91']").css("background-color", "green");
                }
                if (entity.field92 == 1) {
                    $("#upsState_table span[name='field92']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field92']").css("background-color", "green");
                }
                if (entity.field96 == 1) {
                    $("#upsState_table span[name='field96']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field96']").css("background-color", "green");
                }
                if (entity.field97 == 1) {
                    $("#upsState_table span[name='field97']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field97']").css("background-color", "green");
                }
                if (entity.field111 == 1) {
                    $("#upsState_table span[name='field111']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field111']").css("background-color", "green");
                }
                if (entity.field88 == 1) {
                    $("#upsState_table span[name='field88']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field88']").css("background-color", "green");
                }
                if (entity.field93 == 1) {
                    $("#upsState_table span[name='field93']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field93']").css("background-color", "green");
                }
                if (entity.field107 == 1) {
                    $("#upsState_table span[name='field107']").css("background-color", "red");
                } else {
                    $("#upsState_table span[name='field107']").css("background-color", "green");
                }
            }
            // }
        })

    });
    function state(a) {
        if(a){
            return "<span class=\"linkSuccess\"></span>";
        }else {
            return "<span class=\"linkSuccess\" iconCls=\"icon-no\"></span>";
        }

    }
</script>
</div>